import com.zzyl.common.constant.Constants;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

public class VelocityDemoTest {
    public static void main(String[] args) throws IOException {
        Properties p = new Properties();
        p.setProperty("resource.loader.file.class","org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
        Velocity.init(p);

        VelocityContext context = new VelocityContext();
        context.put("message", "jiayou!!!");
        Template template = Velocity.getTemplate("vm/vms/index.html.vm", "UTF-8");
        FileWriter fileWriter = new FileWriter("E:\\WorkPlace\\ry-zzyl-trials\\back\\zzyl\\zzyl-generator\\src\\main\\resources\\model.html");
        template.merge(context, fileWriter);
        fileWriter.close();
    }
}
